package top.jiachunlei.composite;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/12/9 20:21
 */
public class CompositeClient
{
    public static void main(String[] args)
    {
        Composite root = new Composite("root");
        root.add(new Leaf("节点A"));
        root.add(new Leaf("节点B"));

        Composite compositeA = new Composite("分支A");
        compositeA.add(new Leaf("分支再分支A"));
        compositeA.add(new Leaf("分支再分支B"));

        root.add(compositeA);
        root.display(0);
    }
}
